package kr.hkit.androidcomplete03.ETC;

import kr.hkit.androidcomplete03.R;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class FourButtonTest extends Activity {
	Button firstBtn, secondBtn, thirdBtn, fourthBtn;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.fourbutton);

		firstBtn = (Button) findViewById(R.id.firstBtn);
		secondBtn = (Button) findViewById(R.id.secondBtn);
		thirdBtn = (Button) findViewById(R.id.thirdBtn);
		fourthBtn = (Button) findViewById(R.id.fourthBtn);

		firstBtn.setOnClickListener(mOnClickListener);
		secondBtn.setOnClickListener(mOnClickListener);
		thirdBtn.setOnClickListener(mOnClickListener);
		fourthBtn.setOnClickListener(mOnClickListener);

	}

	Button.OnClickListener mOnClickListener = new Button.OnClickListener() {

		@Override
		public void onClick(View v) {
			Intent intent = null;
			
			switch (v.getId()) {
			case R.id.firstBtn:
				intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.co.kr"));
				break;
			case R.id.secondBtn:
				intent = new Intent(Intent.ACTION_VIEW, Uri.parse("tel://010-6476-6584"));
				break;
			case R.id.thirdBtn:
				intent = new Intent(Intent.ACTION_VIEW, Uri.parse("contents://media/internal/images/media"));
				break;
			case R.id.fourthBtn:
				finish();
				break;
			}
			
			startActivity(intent);
		}

	};

}
